﻿using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace PTTPOS_Solution.DAL
{
    public class Custome_DA
    {
        public static DataTable ListCustomer = new DataTable();
        public static void findCustomer(string id_customer)
        {
            MySqlCommand com = new MySqlCommand("select * from tblcustomers where id=@id_customer", Connection_PTTPOS.GetConnection());
            com.Parameters.AddWithValue("id_customer", id_customer);
            com.Connection.Open();
            MySqlDataAdapter da = new MySqlDataAdapter(com);
            ListCustomer.Clear();
            da.Fill(ListCustomer);
            com.Connection.Close();
        }
        public static DataTable listCustomer(string id)
        {
            DataTable tbl = new DataTable();
            MySqlCommand com = new MySqlCommand("select * from tblcustomers where id=@id", Connection_PTTPOS.GetConnection());
            com.Parameters.AddWithValue("@id", id);
            com.Connection.Open();
            MySqlDataAdapter adapter = new MySqlDataAdapter(com);
            adapter.Fill(tbl);
            com.Connection.Close();
            return tbl;
        }
    }
}
